OBJS      = $(SRCS:.cpp=.o)

# which compiler to use
CXX        = mpic++
# flags for compilation and linking 
CFLAGS    += #-DLOG -DDEBUG
LFLAGS    += -o $(PROGRAM)

# valid file suffixes 
.SUFFIXES: .o .cpp

# command to build .o files from .c files
.cpp.o: 
	$(CXX) -c $(CFLAGS) $<

# command to link object files into binary
$(PROGRAM): $(OBJS)
	$(CXX) $(OBJS) $(LFLAGS) 

debug: CFLAGS += -DDEBUG
debug: $(PROGRAM)

log:  CFLAGS += -DLOG
log: $(PROGRAM)

time: CFLAGS += -DTIME
time: $(PROGRAM)

run: $(PROGRAM)
	mpirun -np 2 ./$(PROGRAM)

# other dependencies (based on #includes)

clean:
	/bin/rm -f $(OBJS) $(PROGRAM) *~ *#

